package cn.itcast.controller.stat;

import cn.itcast.base.BaseController;
import cn.itcast.service.StatService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping(value = "/stat")
public class StatController extends BaseController{

    @Reference
    private StatService statService;


    @RequestMapping(name = "到页面展示图形报表",value = "/toCharts")
    public String toCharts(String chartsType){
        // 分别根据不用的参数到自己不用的页面展示
        return "stat/stat-"+chartsType;
    }


    @RequestMapping(name = "统计厂家货物的销售额",value = "/factoryData")
    @ResponseBody
    public List<Map> factoryData(){
        List<Map> list = statService.findFactoryData(company_id);
        return list;
    }

    @RequestMapping(name = "统计货物销售额前15名",value = "/sellData")
    @ResponseBody
    public List<Map> sellData(){
        List<Map> list =statService.findSellData(company_id);
        return list;
    }

    @RequestMapping(name = "24小时系统访问压力图",value = "/onLineData")
    @ResponseBody
    public List<Map> onLineData(){
        List<Map> list =statService.findOnLineData(company_id);
        return list;
    }




}
